package com.intelligentpension.kotlinbluetooth.adapter
import android.annotation.SuppressLint
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.intelligentpension.kotlinbluetooth.R
import com.intelligentpension.kotlinbluetooth.been.BleDev

/**
 * 版权：点赞 版权所有
 * author :赵航
 * @e-mail: zhaohangcn@gmail.com
 * time：2022/3/30
 * describe ：
 */
class BLEDevAdapter(layoutResId: Int, data: MutableList<BleDev>) :
    BaseQuickAdapter<BleDev, BaseViewHolder>(layoutResId, data)  {
    @SuppressLint("MissingPermission")
    override fun convert(holder: BaseViewHolder, item: BleDev) {
        var name = item.dev?.name
        var address = item.dev?.address
        holder.setText(R.id.name_text,String.format("%s, %s, Rssi=%s(Rssi表示信号的强度越接近0越好)", name, address, item.scanResult?.rssi))
        holder.setText(R.id.address_text,String.format("广播数据{%s}", item.scanResult?.scanRecord))
    }
}